<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>对数组中的元素进行挨个运算，不会影响原数组，只会返回一个新的结果，数组</title>
    <script>
       let arr = [3,7,9,-6,-15,5];

       //map会自动遍历，
      let result = arr.map(ele=>{
          if (ele < 0) {
            ele = Math.abs(ele);
          }
          return ele;
      });

      console.log(arr);
      console.log(result);


    </script>
</head>
<body>

</body>
</html>